Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

for-own

Package Overview
Dependencies
Maintainers
2
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

for-own

Iterate over the own enumerable properties of an object, and return an object with properties that evaluate to true from the callback. Exit early by returning `false`. JavaScript/Node.js.

  • 0.1.5
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created

What is for-own?

The for-own npm package is a utility for iterating over the own enumerable properties of an object. It provides a simple and efficient way to loop through an object's properties, executing a callback function for each property.

What are for-own's main functionalities?

Iterate over object properties

This feature allows you to iterate over the own enumerable properties of an object. The callback function receives the value and key of each property.

const forOwn = require('for-own');
const obj = { a: 1, b: 2, c: 3 };
forOwn(obj, function(value, key) {
  console.log(key + ': ' + value);
});

Early exit from iteration

This feature allows you to exit the iteration early by returning false from the callback function. In this example, the iteration stops when the key 'b' is encountered.

const forOwn = require('for-own');
const obj = { a: 1, b: 2, c: 3 };
forOwn(obj, function(value, key) {
  if (key === 'b') return false;
  console.log(key + ': ' + value);
});

Other packages similar to for-own

Keywords

FAQs

Package last updated on 27 Feb 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc